import java.util.Arrays;

/**
 * @Author: swh
 * @Description:
 * @Date: 2021/3/1 15:20
 * @Version: 1.0
 */
public class test3 {
    public static void main(String[] args) {
        //冒泡排序
        int[] arr = new int[]{5, 2, 8, 10, 6};
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if(arr[j]>arr[j+1]){
                    int tem;
                    tem=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=tem;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
